package cn.kgc.shiro02.md5;

import org.apache.shiro.crypto.hash.Md5Hash;

/**
 * @Author: 课工场
 * @Version: v1.0  2023/6/2
 * @Description:
 *
 * s = e10adc3949ba59abbe56e057f20f883e    ->   123456
 * s1 = 370e78d7d264afcf8422f3752d407792   ->123456+helloshiro
 * md5Hash2 = 4f35e5c7ceb7a9d49073dc7f0ee72b22  ->  123456+helloshiro  20
 *
 */
public class TestMD5 {


    public static void main(String[] args) {

        String password = "123456";

        // MD5加密方式
        Md5Hash md5Hash = new Md5Hash(password);
        String s = md5Hash.toHex();
        System.out.println("s = " + s);

        // MD5+salt   123456+hello  随机盐    A:123456+asgegh  B:123456+qrewete

        String salt = "helloshiro";
        Md5Hash md5Hash1 = new Md5Hash(password,salt);
        String s1 = md5Hash1.toHex();
        System.out.println("s1 = " + s1);

        //  MD5+salt+多次 hash
        Md5Hash md5Hash2 = new Md5Hash(password, salt, 20);
        System.out.println("md5Hash2 = " + md5Hash2);


    }


}
